﻿<%@ Page Language="C#" MasterPageFile="~/YUIAspNet.Master" AutoEventWireup="true" CodeBehind="RowSelection.aspx.cs" Inherits="YUIAspNetDemo.DataTable.RowSelection" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>YUIAsp.Net Controls : LiveDemo : DataTable : Row selection</title>
    <script type="text/javascript">
        function GetSelection(sender, args)
        {
            var items = $find("<%= this.dt.ClientID %>").getSelectedRows();
            var selection = "";
            for(var idx = 0; idx < items.length; idx ++)
            {
               //var record = items.getRecord(idx);
               
               selection += "\n"+items[idx].PaidTo;
            }
            
            alert(selection);
            
            args.cancel = true;
        }
    </script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h1>Row selection</h1>
    
    <p>Using the DataTable's EnableRowHover and EnableRowSelection, you can enable row selection and row hover.</p>
    
    <p>Hold down Ctrl key for multiple selections.</p>
    
    <yui:DataTable id="dt" EnableRowHover="true" EnableRowSelection="true" runat="server">
        <Columns>
            <yui:DataTableColumn Key="DatePaid" Sortable="true" Resizeable="true" Text="Date Paid" />
            <yui:DataTableColumn Key="Amount" Resizeable="true" />
            <yui:DataTableColumn Key="PaidTo" />
            <yui:DataTableColumn Key="Remaining" />
            <yui:DataTableColumn Key="For" />
        </Columns>
    </yui:DataTable>
    
    <p><yui:Button ID="btn" OnClientClick="GetSelection" runat="server" Text="Get selection"></yui:Button></p>
</asp:Content>
